package estore;

import java.util.Comparator;

public class ProductSorters {
    // 按商品价格从低到高排序（升序）
    public static final Comparator<Product> BY_PRICE_ASC = Comparator.comparingDouble(Product::getPrice);
    
    // 按商品价格从高到低排序（降序）
    public static final Comparator<Product> BY_PRICE_DESC = Comparator.comparingDouble(Product::getPrice).reversed();
    
    // 按商品库存从多到少排序（降序）
    public static final Comparator<Product> BY_STOCK_DESC = Comparator.comparingInt(Product::getStock).reversed();
}